import configparser


conf=configparser.ConfigParser()
conf['alex']={}
conf['alex']['username']='alex'
conf['alex']['password']='123456'

conf["root"]={}
conf['root']['username']='root'
conf['root']['password']='123123'


with open('accounts.ini','w') as fp:
    conf.write(fp)